package com.abaaba.project2.controller;

import com.abaaba.project2.bean.bo.ConfigOrderBO;
import com.abaaba.project2.bean.vo.BaseRespVo;
import com.abaaba.project2.bean.vo.MallConfigOrderVO;
import com.abaaba.project2.service.MallConfigOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Hedgehog
 * @Date 2021/6/6 22:32
 * @Version 1.0
 */
@RestController
@RequestMapping("admin/config")
public class AdminConfigOrderController {

    @Autowired
    MallConfigOrderService mallConfigOrderService;

    @RequestMapping(value = "order",method = RequestMethod.GET)
    public BaseRespVo configOrderGet(){
        MallConfigOrderVO mallConfigOrderVO=mallConfigOrderService.selectCofigOrder();
        return BaseRespVo.ok(mallConfigOrderVO);
    }

    @RequestMapping(value = "order",method = RequestMethod.POST)
    public BaseRespVo configOrderPost(@RequestBody ConfigOrderBO configOrderBO){

        mallConfigOrderService.updateCofigOrder(configOrderBO);

        return BaseRespVo.ok();
    }

}
